import VueRouter from 'vue-router'

// 导入对应的路由组件
import Home from './components/tabbar/Home'
import Member from './components/tabbar/Member'
import Shopcar from './components/tabbar/Shopcar'
import Search from './components/tabbar/Search'

// 导入Home页面的组件
import NewsList from './components/news/NewsList'
import NewsInfo from './components/news/NewsInfo'

// 创建路由对象
const router = new VueRouter({
  // 配置路由规则
  routes: [
    { path: '/', redirect: '/home' },
    { path: '/home', component: Home },
    { path: '/member', component: Member },
    { path: '/shopcar', component: Shopcar },
    { path: '/search', component: Search },
    // Home页面的组件
    { path: '/home/newsList', component: NewsList},
    { path: '/home/newsInfo/:newsId', component: NewsInfo},

  ],

  //覆盖默认的路由高亮的类,默认的类叫 router-link-active
  linkActiveClass: 'mui-active'

});

// 把路由对象暴露出去
export default router;